#ifndef __DATE_TIME_H_
#define __DATE_TIME_H_

// base on UTC

class DateTime
{
public:
	static DateTime GetCurTime();
	
public:
	DateTime();
	DateTime( time_t t );
	DateTime( const struct tm *tm_s );
	DateTime( int year , int month , int day , int hour = 0 , int minute = 0 , int second = 0 );
	~DateTime();
	
	/* 
	DateTime( const DateTime &dt )
	{
		ntime = dt.GetIime();
	}
	DateTime & operator = ( const DateTime &dt )
	{
		this->ntime = dt.GetIime();
		return *this;
	}
	*/
	
	
	struct tm * GetTm();
	time_t GetIime();
	
	int GetYear();
	int GetMonth();
	int GetDay();
	int GetHour();
	int GetMinute();
	int GetSecond();
	int GetWeek();
	
	string Format();
	
//operator

inline bool operator < ( DateTime x, DateTime y)
{
	return x.GetIime() < y.GetIime(); 
}

inline bool operator <= ( DateTime x, DateTime y)
{
	return x.GetIime() <= y.GetIime(); 
}

inline bool operator > ( DateTime x, DateTime y)
{
	return x.GetIime() > y.GetIime(); 
}

inline bool operator >= ( DateTime x, DateTime y)
{
	return x.GetIime() >= y.GetIime(); 
}

inline bool operator == ( DateTime x, DateTime y)
{
	return x.GetIime() == y.GetIime(); 
}

private:
	time_t ntime;
};

#endif
